package com.netpace.iem.ahmed.utilities;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Helpers {

    public static final String DATE_FORMAT = "dd/MM/yyyy";

    public static String formattedDate(Date date) {
        return new SimpleDateFormat(DATE_FORMAT).format(date);
    }

    public static boolean dateInRange(long time, long lower, long upper) {
        return (time >= lower && time <= upper);
    }

    public static Date parseDate(String string) throws ParseException {
        return new SimpleDateFormat(DATE_FORMAT).parse(string);
    }

//	public static String getTableName(Class<?> type) {
//		return type.getAnnotation(Table.class).name();
//	}
//	
//	public static <T> Map<String, String> getDatabaseFields(Class<T> type, String fieldsToIncludeArray[]) {
//		boolean filterFields = (fieldsToIncludeArray != null) && (fieldsToIncludeArray.length > 0);
//		List<String> fieldsToInclude = filterFields ? Arrays.asList(fieldsToIncludeArray) : null;
//		Map<String, String> fieldsCols = new HashMap<String, String>();
//		for(Field field : type.getDeclaredFields()) {
//			if(field.isAnnotationPresent(Column.class) && 
//					(!filterFields || (filterFields && fieldsToInclude.contains(field.getName())))) {
//				fieldsCols.put(field.getName(), field.getAnnotation(Column.class).name());
//			}
//		}
//		return fieldsCols;
//	}
}
